package com.liao.cloudstorage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.liao.cloudstorage.entity.Key;
import com.liao.cloudstorage.mapper.KeyMapper;
import com.liao.cloudstorage.service.IKeyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author liao
 * @since 2019-04-24
 */
@Service
public class KeyServiceImpl extends ServiceImpl<KeyMapper, Key> implements IKeyService {


    @Resource
    private KeyMapper mapper;

    @Override
    public Key getKeyByUserId(Integer userId) {
        return mapper.selectOne(new QueryWrapper<Key>().eq("user_id", userId));
    }
}
